import { defineStore } from 'pinia'
// import {addrBookList,addrBookAdds,addrBookdelete} from '@/@api/addrBook'
interface addBookType{
    addrBook:any
}
const useAddrBookStore = defineStore("addrBook",{
    state:():addBookType => ({
        addrBook:{
            btcaId: "123",
            creaTetime: "2023-05-23T00:45:56.394Z",
            customerCode: "000000",
            email: "",
            infoType: "",
            isDefault: "",
            latitude: "",
            longitude: "",
            preAdd: "1",
            preAddress: "",
            preAddressNote: "",
            preArea: "1",
            preMobile: "1",
            preName: "",
            preTel: "",
            updateTime: "2023-05-23T00:45:56.394Z"
        }
    }),
    actions:{
       async addrBookAdd(msg){
            this.addrBook.btcaId = msg.id
            this.addrBook.preName = msg.name;
            this.addrBook.email = msg.email
            this.addrBook.infoType = msg.infoType
            this.addrBook.isDefault = msg.isDefault
            this.addrBook.latitude = msg.latitude
            this.addrBook.longitude = msg.longitude
            this.addrBook.preAddress = msg.address
            this.addrBook.preAddressNote = msg.addresspro
            this.addrBook.preTel = msg.phone
            let res = await addrBookAdds(this.addrBook)
            console.log(res,'res');
            
            
            
        },
        async addrBookList(msg){
            console.log(msg,'addrBookList');
            // let res = await addrBookList(msg)
        }

    },
    getters:{
        
    }
})

export default useAddrBookStore